﻿<Serializable()> Public Class BrokerList
    Inherits List(Of Broker)

    '<Serializable()> Public Class BrokerList
    '    Inherits List(Of Broker)


    Public Sub New()

    End Sub

    Function GetBrokerByName(ByVal BrokerName As String) As Broker
        Dim myBroker As Broker = Nothing
        For Each b As Broker In Me
            If b.BrokerName.ToLower.Trim = BrokerName.ToLower.Trim Then
                myBroker = b
                Exit For
            End If
        Next
        Return myBroker
    End Function
    Function PopulateBroker(ByVal BrokerName As String) As Broker
        Dim myBroker As Broker = My.Settings.AllBrokers.GetBrokerByName(BrokerName)

        If myBroker Is Nothing Then
            Throw New InvalidOperationException("No broker by the code " & BrokerName & ".  Please add/update and re-run.")
        Else
            Return myBroker
        End If
    End Function
End Class
